import {doGet, appJsonPost, formPost} from '@/network/request';


/**
 * 获取文件列表
 * @returns Promise
 */
export function getFileListApi() {
    return doGet({
        url: '/indexRes/list',

    });
}

/**
 * 根据类型获取文件
 * @returns Promise
 */
export function getResByTypeApi(type) {
    return doGet({
        url: '/indexRes/getResByType',
        params: {
            type: type
        },

    });
}
/**
 * 提交
 * @returns Promise
 */
export function addFileApi(data: object) {
    return appJsonPost({
        url: "/indexRes/addRes",
        data: data,

    });
}

/**
 * 上传文件
 * @param formData 文件表单数据
 * @returns Promise
 */
export function uploadFileApi(formData: FormData) {
    return appJsonPost({
        url: '/indexRes/upload',
        data: formData,

    });
}

/**
 * 删除文件
 * @param fileId 文件的ID
 * @returns Promise
 */
export function deleteFileApi(fileId: string) {
    return doGet({
        url: `/indexRes/delete/${fileId}`,

    });
}
